/*
 * @Author: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @Date: 2022-08-16 14:21:02
 * @LastEditors: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @LastEditTime: 2022-08-27 08:36:52
 * @FilePath: \后端管理系统\app\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue'),
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import(/* webpackChunkName: "login" */ '../views/Home.vue'),
    children: [
      {
        path: '/welcome',
        name: 'Welcome',
        component: () => import(/* webpackChunkName: "home" */ '../views/Welcome.vue'),
      },
      // 用户列表
      {
        path: '/users',
        name: 'Users',
        meta: {
          breadList: ['用户管理', '用户列表']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Users'),
      },
      {
        path: '/welcome',
        name: 'welcome',
        component: () => import(/* webpackChunkName: "home" */ '../views/Welcome.vue'),
      },
      {
        path: '/roles',
        name: 'Roles',
        meta: {
          breadList: ['权限管理', '角色列表']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Roles'),
      },
      {
        path: '/rights',
        name: 'Rights',
        meta: {
          breadList: ['权限管理', '权限列表']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Rights'),
      },
      {
        path: '/goods',
        name: 'Goods',
        meta: {
          breadList: ['商品管理', '商品列表']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Goods'),
      },
      {
        path: '/add',
        name: 'Add',
        meta: {
          breadList: ['商品管理', '添加商品']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Goods/Add.vue'),
      },
      {
        path: '/params',
        name: 'Params',
        meta: {
          breadList: ['商品管理', '分类参数']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Goods/Params.vue'),
      },
      {
        path: '/categories',
        name: 'Categories',
        meta: {
          breadList: ['商品管理', '商品分类']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Categories/index.vue'),
      },
      {
        path: '/orders',
        name: 'Orders',
        meta: {
          breadList: ['订单管理', '订单列表']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Orders/index.vue'),
      },
      {
        path: '/reports',
        name: 'Reports',
        meta: {
          breadList: ['数据统计', '数据报表']
        },
        component: () => import(/* webpackChunkName: "home" */ '../views/Reports/index.vue'),
      },
    ]
  },

  {
    path: '*',
    component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue')
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "login" */ '../views/Error/404.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
